# File: dir.py
class A:
    def a(self):
        pass
    def b(self):
        pass

class B(A):
    def c(self):
        pass
    def d(self):
        pass

def getMembers(klass, members = None):
    # get a list of all class members, ordered by class
    if members is None:
        members = []
        
    for k in klass.__bases__:
        getMembers(k, members)
        
    for m in dir(klass):
        if m not in members:
            members.append(m)
    return members

print getMembers(A)
print getMembers(B)
print getMembers(IOError)